<template>
  <view class="service-container">
    <!-- 顶部图片 -->
    <image src="/static/guide/10.jpg" class="header-image" mode="aspectFill"/>
    
    <!-- 紧急服务区域 -->
    <view class="service-section emergency">
      <view class="section-title">
        <text class="title-text">紧急服务</text>
      </view>
      <view class="card-grid">
        <view class="service-card emergency-card" @click="showModal">
          <text class="icon">📞</text>
          <text class="card-title">旅游咨询</text>
          <text class="card-desc">12301</text>
        </view>
        <view class="service-card emergency-card" @click="showModal1">
          <text class="icon">🆘</text>
          <text class="card-title">投诉求助</text>
          <text class="card-desc">12315</text>
        </view>
      </view>
    </view>

    <!-- 便民服务区域 -->
    <view class="service-section">
      <view class="section-title">
        <text class="title-text">便民服务</text>
      </view>
      <view class="card-grid">
        <navigator url="service1" class="service-card">
          <text class="icon">🚌</text>
          <text class="card-title">公交信息</text>
          <text class="card-desc">智慧出行</text>
        </navigator>
        
        <navigator url="service2" class="service-card">
          <text class="icon">🅿️</text>
          <text class="card-title">停车服务</text>
          <text class="card-desc">便捷停车</text>
        </navigator>
        
        <navigator url="service3" class="service-card">
          <text class="icon">🚽</text>
          <text class="card-title">卫生间</text>
          <text class="card-desc">便民设施</text>
        </navigator>
        
        <navigator url="service4" class="service-card">
          <text class="icon">☁️</text>
          <text class="card-title">天气预报</text>
          <text class="card-desc">实时天气</text>
        </navigator>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      // 页面的初始数据
    };
  },
  methods: {
    showModal() {
      uni.showModal({
        title: '旅游咨询',
        content: '呼叫12301。',
        showCancel: true,
        confirmText: '确定',
        success: (res) => {
          if (res.confirm) {
            console.log('用户点击确定');
          } else if (res.cancel) {
            console.log('用户点击取消');
          }
        }
      });},
	  showModal1() {
	    uni.showModal({
	      title: '投诉求助',
	      content: '呼叫12315',
	      showCancel: true,
	      confirmText: '确定',
	      success: (res) => {
	        if (res.confirm) {
	          console.log('用户点击确定');
	        } else if (res.cancel) {
	          console.log('用户点击取消');
	        }
	      }
	    });
    }
  }
};
</script>

<style>
.service-container {
  min-height: 100vh;
  background-color: #f5f7fa;
  padding-bottom: 20px;
}

.header-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.service-section {
  margin: 20px 16px;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.emergency {
  margin-top: -40px;
  position: relative;
  z-index: 1;
}

.section-title {
  margin-bottom: 16px;
}

.title-text {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  position: relative;
  padding-left: 12px;
}

.title-text::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 16px;
  background: #007aff;
  border-radius: 2px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.service-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.3s ease;
  border: 1px solid #eaeaea;
  position: relative;
  overflow: hidden;
}

.service-card::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0) 60%);
  transform: scale(0);
  opacity: 0;
  transition: transform 0.6s, opacity 0.6s;
}

.service-card:active::after {
  transform: scale(2);
  opacity: 1;
  transition: 0s;
}

.emergency-card {
  background: linear-gradient(135deg, #007aff, #3c9cff);
  transform-origin: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: breathe 2s ease-in-out infinite;
}

.emergency-card .icon,
.emergency-card .card-title,
.emergency-card .card-desc {
  color: #fff;
}

.emergency-card:active {
  transform: scale(0.95);
  box-shadow: 0 0 20px rgba(0, 122, 255, 0.3);
}

.service-card:not(.emergency-card) {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.service-card:not(.emergency-card):active {
  background: #f8f9fa;
  transform: translateY(2px);
}

.icon {
  font-size: 28px;
  margin-bottom: 8px;
  transition: transform 0.3s ease;
}

.service-card:active .icon {
  transform: scale(1.1);
}

.title-text {
  font-size: 16px;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
  background: linear-gradient(45deg, #333 0%, #666 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  color: transparent;
  animation: gradientText 3s ease infinite;
}

@keyframes gradientText {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes breathe {
  0% {
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.4);
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
    transform: scale(1);
  }
}

.service-section {
  animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.emergency .card-grid {
  grid-template-columns: repeat(2, 1fr);
}
</style>